package galaxy.drawer.action;

import galaxy.drawer.Context;

import java.util.Deque;
import java.util.LinkedList;

public class StackAction {
	private Deque<Context> stack = new LinkedList<Context>();
	private Action push = new Action() {
		public Context execute(Context c) {
			stack.push(c);
			return c.clone();
		}
	};
	private Action pop = new Action() {
		public Context execute(Context c)
		{
			return stack.pop();
		}
	};
	
	public StackAction setStack(Deque<Context> stack)
	{
		this.stack = stack;
		return this;
	}
	
	public Deque<Context> getStack()
	{
		return stack;
	}
	
	public Action getPushAction()
	{
		return push; 
	}
	
	public Action getPopAction()
	{
		return pop;
	}
}
